package models

import "time"

type SysUser struct {
	ID        uint `gorm:"primary_key" json:"id"`
	Username string `json:"username" gorm:"unique_index;not null"`
	Nickname string `json:"nickname"`
	Password string `json:"password"`
	AvatarUrl string `json:"avatar_url" gorm:"default:'static/upload/avatar/default.png'"`
	RoleId int `json:"role_id" gorm:"default:1"`
	MajorID int `json:"major_id"`
	Grades string `json:"grades"`
	State bool `json:"state" gorm:"default:0"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	Role SysRole `gorm:"ForeignKey:RoleId;AssociationForeignKey:RoleId" json:"role"`
	Major SysMajor `gorm:"ForeignKey:MajorID;AssociationForeignKey:ID" json:"major"`
	ClassList []SysClass `json:"class_list"`
}

